@echo off
echo ====================================
echo DTSEToolBox 完整启动脚本
echo （前端 + 后端）
echo ====================================
echo.

echo [1] 检查环境...
where node >nul 2>nul
if %errorlevel% neq 0 (
    echo [错误] 未找到 Node.js
    pause
    exit /b 1
)

where python >nul 2>nul
if %errorlevel% neq 0 (
    echo [错误] 未找到 Python
    pause
    exit /b 1
)

echo [2] 安装前端依赖...
if not exist "node_modules\" (
    call npm install
)

echo [3] 安装后端依赖...
if not exist "server\venv\" (
    cd server
    python -m venv venv
    call venv\Scripts\activate
    pip install -r requirements.txt
    cd ..
)

echo.
echo [4] 启动服务...
echo [提示] 前端: http://localhost:3000
echo [提示] 后端: http://localhost:5000
echo.

start "DTSEToolBox Frontend" cmd /k "npm run dev"
timeout /t 3 /nobreak >nul
start "DTSEToolBox Backend" cmd /k "cd server && venv\Scripts\activate && python app.py"

echo [完成] 服务已启动
echo.
pause


